<?php if(isset($pages)): ?>
<div class="pagination">
	<?php
	list($beginPage, $endPage, $beginItem, $endItem) = $range;
    if($pages->getPageCount() > 1): 
        list($beginPage, $endPage) = $range;
    ?>
    
        <?php if($pages->getCurrentPage() == 0): ?>
            <span>« First</span>
        <?php else: ?>
            <a href="<?php echo $pages->createPageUrl($this->getController(),0); ?>">« First</a>
        <?php endif; ?>
        
        
        <?php for($i=$beginPage; $i<=$endPage; $i++): ?>
            <?php if($pages->getCurrentPage() == $i): ?>
                <span class="active"><?php echo $i+1; ?></span>
            <?php else: ?>
                <a href="<?php echo $pages->createPageUrl($this->getController(),$i); ?>"><?php echo $i+1; ?></a>
            <?php endif; ?>
        <?php endfor;?>
        <!--<a href="">2</a>
        <a href="">3</a>
        <a href="">4</a>
        <span>...</span>
        <a href="">23</a>
        <a href="">24</a>-->
        
        <?php if($pages->getCurrentPage() == $pages->getPageCount()-1): ?>
            <span>Last »</span>
        <?php else: ?>
            <a href="<?php echo $pages->createPageUrl($this->getController(),$pages->getPageCount()); ?>">Last »</a>
        <?php endif; ?>
    <?php endif; ?>
    <?php echo "Found: {$beginItem}-{$endItem} of {$pages->getItemCount()} items "; ?>
</div>
<?php endif; ?>